package com.zjxh.zjxh.mob.controller;

import com.zjxh.zjxh.common.Result;
import com.zjxh.zjxh.common.aop.ApiLog;
import com.zjxh.zjxh.mob.service.FileService;
import com.zjxh.zjxh.mob.vo.req.FileUploadReq;
import com.zjxh.zjxh.mob.vo.resp.FileUploadResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.servlet.http.HttpServletRequest;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: oyp
 * @date: 2024/5/28 on 14:48
 * @desc:
 */
@Api(tags = "群众端-文件统一上传")
@RestController
@RequestMapping("/common")
public class FileCommonController {

  private final FileService fileService;

  public FileCommonController(FileService fileService) {
    this.fileService = fileService;
  }

  @ApiLog("上传图片")
  @ApiOperation("上传图片")
  @PostMapping("upload-image")
  public Result<FileUploadResp> fileUpload(
      HttpServletRequest request, @Validated FileUploadReq req) {
    return fileService.fileUpload(request, req);
  }
}
